<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Pages.aspx.cs" Inherits="Impact.Web.Admin.Pages" EnableEventValidation="false" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <table class="AdminTable">
        <tr>
            <th>Pages:</th>
            <th class="NonHeader">Template</th>
            <th class="NonHeader">Enabled</th>
            <th class="NonHeader">Plugins</th>
            <!-- <th class="NonHeader">Preview</th> -->
            <th class="NonHeader">Order</th>
            <th class="NonHeader">Delete</th>
        </tr>


    <asp:Repeater ID="pageList" runat="server" OnItemCommand="PageList_ItemCommand">
        <ItemTemplate>
            <tr>
                <td style="width: 200px; text-align: left; padding-left: 30px;">
                    <a href="EditPage.aspx?pid=<%# Eval("PageId") %>"><%# Eval("Caption") %></a>
                </td>
                
                <td style="text-align: center;">
                    [<%# (Eval("Template") != null) ? Eval("Template.Name") : "None" %>]
                </td>
                
                <td style="text-align: center;">
                    <asp:ImageButton ID="enabledButton" CommandName="toggle" CommandArgument='<%# Eval("PageId") %>' 
                        ImageUrl='<%# Convert.ToBoolean(Eval("Enabled")) ? "images/checked.png" : "images/unchecked.png" %>' runat="server" />
                </td>
                
                <td style="text-align: center;">
                    <a href="editplugins.aspx?pid=<%# Eval("PageId") %>&ReturnUrl=<%= Server.UrlEncode(Request.Url.ToString()) %>"><img src="images/plugin.png" border="0" alt="" /></a>
                </td>
                
                <%-- 
                <td style="text-align: center;">
                    <asp:ImageButton ID="previewButton" CommandName="preview" CommandArgument='<%# Eval("PageID") %>'
                        ImageUrl="images/magnifier.png" runat="server" />
                </td> --%>

                <td style="text-align: center;">
                    <asp:ImageButton ID="upButton" CommandName="up" CommandArgument='<%# Eval("PageId") %>' 
                        ImageUrl="images/arrow_up.png" runat="server" />
                    <asp:ImageButton ID="downButton" CommandName="down" CommandArgument='<%# Eval("PageId") %>'
                        ImageUrl="images/arrow_down.png" runat="server" />
                </td>
                        
                <td style="text-align: center;">
                    <asp:ImageButton ID="deleteButton" CommandName="delete" CommandArgument='<%# Eval("PageId") %>'
                        ImageUrl="images/red-x.png" runat="server" />
                </td>
            </tr>
                               
        </ItemTemplate>
    </asp:Repeater>
    
    <asp:Panel ID="noPagesPanel" Visible="false" runat="server">
        <tr>
            <td colspan="7">There have been no pages defined yet.</td>
        </tr>
    </asp:Panel>
    
        <tr>
            <td colspan="7" style="text-align: right;">
                <impact:ImageLinkButton ID="newPageButton" CssClass="AdminTableButton" runat="server"
                    ImageUrl="images/add.png" Text="Create New Page" TargetUrl="EditPage.aspx" />
            </td>
        </tr>
    </table>


</asp:Content>
